package com.blqy.fr.user.api;

import com.blqy.fr.common.result.Result;
import com.blqy.fr.model.user.User;
import com.blqy.fr.user.service.UserService;
import com.blqy.fr.vo.user.UserDetailVo;
import com.blqy.fr.vo.user.UserMyVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "用户信息接口")
@RestController
@Slf4j
@RequestMapping("/api/user/info")
public class UserInfoController {
    @Autowired
    private UserService userService;

    @GetMapping("/findUserTwo/{userId}/{roleId}")
    public Result<UserMyVo> findUserTwo(@PathVariable Long userId, @PathVariable Long roleId){
        UserMyVo userMyVo = userService.findUserTwo(userId,roleId);
        return Result.ok(userMyVo);
    }

    @GetMapping("/findUserThree/{id}")
    public Result<UserDetailVo> findUserThree(@PathVariable Long id) {
        UserDetailVo userDetailVo = userService.findUserThree(id);
        return Result.ok(userDetailVo);
    }

    @PutMapping("/updateUserInfo")
    public Result<UserDetailVo> updateUserInfo(@RequestBody UserDetailVo userDetailVo) {
        userService.updateUserInfo(userDetailVo);
        return Result.ok();
    }
}
